package com.neasho.neashoadminv1.web.schedules

import com.neasho.neashoadminv1.infrastructure.utils.MDCUtils
import com.neasho.neashoadminv1.infrastructure.utils.MdcLogType
import org.slf4j.LoggerFactory
import org.slf4j.MDC
import org.springframework.stereotype.Component

@Component
class TestSchedule {

    val log = LoggerFactory.getLogger(TestSchedule::class.java)

//    @Scheduled(cron = "0/5 * * * * *")
    fun task1() {
        MDCUtils.openTraceId(MdcLogType.task)
        try {
            log.info("hello task1")
        } catch (e: Exception) {
            log.error("error occurred: ", e)
        }finally {
            MDC.clear()
        }
    }
}